package me.maiz.tool.codemonitor.service.impl;

import me.maiz.tool.codemonitor.dal.StudentRepo;
import me.maiz.tool.codemonitor.entity.Student;
import me.maiz.tool.codemonitor.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentRepo studentRepo;

    @Override
//    @Cacheable(cacheNames="stuCache",key = "#{email+'_'+username}")
    public String mapRealname(String email, String username) {
        Student student = studentRepo.findByEmailOrGiteeUsername(email, username);
        return student==null?null:student.getName();
    }

}
